<?php $this->load->view('header',array('title'=>$title));?>
<style>
<!--
body, html {
	  background-color: #FFF;	
}
#box-table-a {
    border-collapse: collapse;  
    font-size: 12px;    
    text-align: left;
    width: 100%;
    margin-bottom:50px;
}
#box-table-a th {
    background: none repeat scroll 0 0 #E7E5E2;
    border-bottom: 1px solid #D0CDC7;
    border-top: 4px solid #888888;  
    font-size: 13px;
    font-weight: normal;
    padding: 8px;
}
#box-table-a td {
    background: none repeat scroll 0 0 #FFF;
    border-bottom: 1px solid #D0CDC7;
    border-top: 1px solid transparent;   
    padding: 8px;
}
#box-table-a tr:hover td {
    background: none repeat scroll 0 0 #DDDDDD;
}
table td{
	 padding: 8px;
}


form {
    margin: 0;
    padding: 0;
}

label {
    float: left;   
    text-align: left;
    width: 100px;
}
fieldset div {
    display: block;
    margin-bottom: 0.5em;
    padding: 0;
}
fieldset div input, fieldset div textarea {
    border-color: #555555 #CCCCCC #CCCCCC #555555;
    border-style: solid;
    border-width: 1px;
    color: #333333;
    padding: 1px;
    width: 200px;
}
fieldset div select {
    padding: 1px;
	width: 100px;
}
div.fm-multi div {
    margin: 5px 0;
}
div.fm-multi input {
    width: 1em;
}
div.fm-multi label {
    display: block;
    padding-left: 5em;
    text-align: left;
    width: 200px;
}
#fm-submit {
    clear: both;
    padding-top: 1em;
    text-align: center;
}

input:focus, textarea:focus {
    background: none repeat scroll 0 0 #EFEFEF;
    color: #000000;
}
fieldset div.fm-req {
    font-weight: bold;
}

p#fm-intro {
    margin: 0;
}

.boxline{
	border:1px solid #D0CDC7;padding:20px 45px;margin-bottom:20px;
}
-->
</style>
<div style="margin:100px 50px 0 50px;">
 <?php if(!$this->User_model->isLogin()):?>
	<div class="boxline" id="email-box">
		<div class="edit" >
			<form action="" method="post">
			<fieldset>
				<div class="fm-req">
					<label for="fm-email">电子邮箱：</label>
					<input type="text"  name="email" size="30" id="fm-email" /> 
					<a href="javascript:void(0);" class="button submit size14 hl" >确定</a>
				</div>
			</fieldset>
			<p style="color:#999999">您可能是信任登录用户，系统未记录您的邮箱，此邮箱用来接收订单跟踪邮件，便于您及时了解订单状态</p>
			</form>
		</div>
		<div class="info" style="display:none">
			<div></div>
			<a href="#" class="alter">修改</a>
		</div>
	</div>
<?php endif;?>
	
	<h3>收货人信息</h3>
	<div class="boxline" id="address-box">
		<div class="edit" <?php if($address):?>style="display:none"<?php endif?>>
			<form action="http://www.stylephreak.com/index.php/archives/2004/08/standard-forms/" method="post" id="fm-form">
			<fieldset>
				<div class="fm-req"  id="address" >
					<label for="adrs-province">收货地区：</label>
					<select name="province" id="adrs-province"  <?php if($address):?> dataid="<?php echo $address['province']?>" <?php endif?>>						
					</select> - 
					<select name="city" id="adrs-city">
					<option value=""></option>
							<?php 
					if($address){
								
								$areas = $this->address->getAreas();
								foreach($areas[$address['province']]['c'] as $id => $area){
									if($id == $address['city'])
										echo '<option value="'.$id.'" selected>'.$area['name'].'</option>';
									else
										echo '<option value="'.$id.'">'.$area['name'].'</option>';
								}
					}
					?>
					</select> -
					<select name="zone" id="adrs-zone">
					<option value=""></option>
							<?php 
					if($address){
								
								$areas = $this->address->getAreas();
								foreach($areas[$address['province']]['c'][$address['city']]['c'] as $id => $area){
									if($id == $address['zone'])
										echo '<option value="'.$id.'" selected>'.$area['name'].'</option>';
									else
										echo '<option value="'.$id.'">'.$area['name'].'</option>';
								}
					}
					?>
					</select> <span class="qdcolor">*</span>
				</div>
				<div class="fm-opt">
				<label>收货地址：</label>
				<span id="adrstext"><?php if($address) {$addressinfo = $this->address->getAreasById($address['province'],$address['city'],$address['zone']); echo $addressinfo;}?></span><input type="text" name="address"  <?php if($address&&isset($address['address'])):?> value="<?php echo $address['address']?>" <?php endif?>> <span class="qdcolor">*</span>  &nbsp;&nbsp;&nbsp;<b>邮编：</b> <input type="text" name="zipcode"  <?php if($address&&isset($address['zipcode'])):?> value="<?php echo $address['zipcode']?>" <?php endif?> />
				</div>
				<div class="fm-req">
				<label for="consignee">收货人姓名：</label>
				<input type="text" id="consignee" name="consignee"  <?php if($address&&isset($address['consignee'])):?> value="<?php echo $address['consignee']?>" <?php endif?>> <span class="qdcolor">*</span> 
				</div>
								
				<div class="fm-opt">
				<label for="mobile">手机：</label>
				<input type="text" name="mobile" id="mobile" <?php if($address&&isset($address['mobile'])):?> value="<?php echo $address['mobile']?>" <?php endif?> > 或 <b>固定电话：</b> <input type="text" name="telephone" id="telephone" <?php if($address&&isset($address['telephone'])):?> value="<?php echo $address['telephone']?>" <?php endif?> > <span class="qdcolor">*</span> 手机或固定电话必须填写其中一项
				</div>

			</fieldset>
			<div class="fm-req" id="fm-submit">
			<a href="javascript:void(0);" class="button submit size14 hl" >确定收货人信息</a>
			</div>
			</form>
		</div>
		<div class="info" <?php if(!$address):?>style="display:none"<?php endif?>>
			<div><?php	
			if($address){
					echo "收货地址：{$addressinfo}{$address['address']}<br />";
					if($address['zipcode'])
						echo "邮编：{$address['zipcode']}<br />";
					echo "收货人姓名：{$address['consignee']}<br />";
					if($address['mobile'])
						echo "手机：{$address['mobile']}<br />";
					if($address['telephone'])
						echo "固定电话：{$address['telephone']}<br />";
			}
			?></div>
			<a href="#" class="alter">修改</a>
		</div>
	</div>
	
	
	<h3>购买的商品</h3>
	<table summary="Employee Pay Sheet" id="box-table-a">
	    <thead>
	    	<tr>
	        	<th scope="col">图片</th>
	            <th scope="col">商品名称</th>
	            <th scope="col">销售价格</th>
	            <th scope="col">优惠价格</th>
	            <th scope="col">数量</th>
	            <th scope="col">小计</th>
	            <th scope="col">操作</th>
	        </tr>
	    </thead>
	    <tbody>
	    	<?php foreach($data as $d):?>
	    	<tr goodsid="<?php echo $d['goods_id']?>">
	        	<td><img src="<?php echo $d['goods_thumb']?>"/></td>
	            <td><?php echo $d['goods_name']?></td>
	            <td>￥<?php echo $d['market_price']?></td>
	            <td class="unitprice">￥<?php echo $d['shop_price']?></td>
	            <td class="cart_action"><a class="decrease" href="javascript:void(0)" style="font-weight:bold;font-size:30px" >-</a>&nbsp;<input type="text"  class="gnums" style="font-size:20px;width:30px;text-align:center" value="<?php echo $d['sum']?>" />&nbsp;<a href="javascript:void(0)" class="increase" style="font-weight:bold;font-size:25px">+</a></td>
	            <td class="price">￥<?php echo $d['price']?></td>
	            <td><a href="#">删除</a></td>
	        </tr>
	        <?php endforeach;?>	       
	    </tbody>
	</table>
	<div class="boxline">
		<table style="float:right">
		<tr><td  style="vertical-align:top">当前享受的订单优惠：</td><td>
		<ul><li>1、全场免运费</li><li>2、幸运大礼，每天一百名，数量有限，送完为止</li></ul>
		</td></tr>
		<tr><td style="font-size:14px">商品总额：</td><td id="cart_sum" style="font-weight:bold;font-size:14px">
		￥0
		</td></tr>
		</table>
		<div style="clear:both;"></div>
	</div>
	<div style="padding:20px 0px;position:relative;">
		<a href="<?php echo site_url('cart/index')?>" class="button">返回购物车</a><a style="position:absolute;right:0;" href="<?php echo site_url('order/payment')?>" class="button hl">提交订单</a>
	</div>	
</div>

<?php $this->load->view('footer');?>